import { createSlice } from "@reduxjs/toolkit";
import { useReducer } from "react";

const userStore = createSlice({
    name:'user!!',
    //数据状态
    initialState:{
        token:''
    },
    //同步修改方法
    reducers:{
        setToken(state,action){
            state.token = action.payload
        }
    }
})

//结构出actionCreater
const {setToken} = userStore.actions


//获取reducer函数
const useReducer = userStore.reducer








export {setToken}
export default useReducer